#pragma config(Sensor, in1,    leftLine,       sensorLineFollower)
#pragma config(Sensor, in2,    middleLine,     sensorLineFollower)
#pragma config(Sensor, in3,    rightLine,      sensorLineFollower)
#pragma config(Sensor, dgtl1,  rightEncoder,   sensorQuadEncoder)
#pragma config(Sensor, dgtl3,  leftEncoder,    sensorQuadEncoder)
#pragma config(Motor,  port1,           leftMotor,     tmotorVex393, openLoop, reversed)
#pragma config(Motor,  port2,           turntable,     tmotorVex393, openLoop)
#pragma config(Motor,  port10,          rightMotor,    tmotorVex393, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

void goRoom1();
void goRoom2();
void goRoom3();
void goRoom4();
void goRoom5();

task main()
{

	while(true){

		if(vexRT[Btn8U]){
			goRoom1();
		}
	  if(vexRT[Btn8L]){
			goRoom2();
	  }
	  if(vexRT[Btn8R]){
	  	goRoom3();
	  }
		if(vexRT[Btn8D]){
			goRoom4();
		}
		if(vexRT[Btn6U]){
			goRoom5();
		}

	}

}

void goRoom1(){

  wait1Msec(1000);

	SensorValue[rightEncoder] = 0;
	SensorValue[leftEncoder] = 0;

	while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
		//Turn slightly left
	}
 }
 wait1Msec(395);
//FINISH FIRST LENGTH

motor[leftMotor] = 0; //set motors to 0
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0; //set encoders to 0
SensorValue[rightEncoder] = 0;


//START TURN
while(SensorValue[rightEncoder]> -285|| SensorValue[leftEncoder]< 285)
	{
	motor[leftMotor] = 75;
	motor[rightMotor] = -75;

	if(SensorValue[rightEncoder]< -285)
		{
			motor[rightMotor] = 0;
		}
if(SensorValue[leftEncoder]> 285)
	 {
	motor[leftMotor] = 0;
   }

 }

motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0;
SensorValue[rightEncoder] = 0;

//START SECOND LENGTH
while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
		//Turn slightly left
  }
}
 wait1Msec(410);
//FINISH SECOND LENGTH

 motor[rightMotor] = 0;
 motor[leftMotor] = 0;
 wait1Msec(1000);
 SensorValue[leftEncoder] = 0;
 SensorValue[rightEncoder] = 0;

//START TURN
while(SensorValue[rightEncoder]> -290 || SensorValue[leftEncoder]< 290)
	{
	motor[leftMotor] = 75;
	motor[rightMotor] = -75;

	if(SensorValue[rightEncoder]< -290)
		{
			motor[rightMotor] = 0;
		}
if(SensorValue[leftEncoder]> 290)
	 {
	motor[leftMotor] = 0;
   }

 }
//FINISH TURN

 motor[leftMotor] = 0;
 motor[rightMotor] = 0;
 wait1Msec(1000);
 SensorValue[rightEncoder] = 0;
 SensorValue[leftEncoder] = 0;

//START THIRD LENGTH
 while(SensorValue[rightEncoder]< 80 || SensorValue[leftEncoder]< 80 )		// Creates an infinite loop, since "true" always evaluates to true
	{
		if(SensorValue[rightEncoder] == SensorValue[leftEncoder]) // If rightEncoder has counted the same amount as leftEncoder:
		{
			// Move Forward
			motor[rightMotor] = 75;
			motor[leftMotor]  = 75;
		}
		else if(SensorValue[rightEncoder] > SensorValue[leftEncoder])	// If rightEncoder has counted more encoder counts
		{
			// Turn slightly right
			motor[rightMotor] = 50;
			motor[leftMotor]  = 75;
		}
		else	// Only runs if leftEncoder has counted more encoder counts
		{
			// Turn slightly left
			motor[rightMotor] = 75;
			motor[leftMotor]  = 50;
		}
	}
	motor[leftMotor] = 0;
	motor[rightMotor] = 0;
	wait1Msec(1000);
	SensorValue[rightEncoder] = 0;
	SensorValue[leftEncoder] = 0;

//FINISH THIRD LENGTH

//RETURN

	//START FOURTH LENGTH
 while(SensorValue[rightEncoder]> -80 || SensorValue[leftEncoder]> -80 )		// Creates an infinite loop, since "true" always evaluates to true
	{
		if(SensorValue[rightEncoder] == SensorValue[leftEncoder]) // If rightEncoder has counted the same amount as leftEncoder:
		{
			// Move Forward
			motor[rightMotor] = -75;
			motor[leftMotor]  = -75;
		}
		else if(SensorValue[rightEncoder] < SensorValue[leftEncoder])	// If rightEncoder has counted more encoder counts
		{
			// Turn slightly right
			motor[rightMotor] = -50;
			motor[leftMotor]  = -75;
		}
		else	// Only runs if leftEncoder has counted more encoder counts
		{
			// Turn slightly left
			motor[rightMotor] = -75;
			motor[leftMotor]  = -50;
		}
	}
	motor[leftMotor] = 0;
	motor[rightMotor] = 0;
	wait1Msec(1000);
	SensorValue[rightEncoder] = 0;
	SensorValue[leftEncoder] = 0;

//FINISH FOURTH LENGTH
//START TURN

	while(SensorValue[rightEncoder]> -285 || SensorValue[leftEncoder]< 285)
	{
	motor[leftMotor] = 75;
	motor[rightMotor] = -75;

	if(SensorValue[rightEncoder]< -285)
		{
			motor[rightMotor] = 0;
		}
if(SensorValue[leftEncoder]> 285)
	 {
	motor[leftMotor] = 0;
   }

 }
//FINISH TURN

 motor[leftMotor] = 0;
 motor[rightMotor] = 0;
 wait1Msec(1000);
 SensorValue[rightEncoder] = 0;
 SensorValue[leftEncoder] = 0;

//START FIFTH LENGTH

 while(SensorValue[middleLine] < 2500 || SensorValue[leftLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
		//Turn slightly left
	}
 }
 wait1Msec(410);


 motor[leftMotor] = 0; //set motors to 0
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0; //set encoders to 0
SensorValue[rightEncoder] = 0;

//START TURN
while(SensorValue[leftEncoder]> -287 || SensorValue[rightEncoder]< 287)
	{
	motor[rightMotor] = 75;
	motor[leftMotor] = -75;

	if(SensorValue[leftEncoder]< -287)
		{
			motor[leftMotor] = 0;
		}
if(SensorValue[rightEncoder]> 287)
	 {
	motor[rightMotor] = 0;
   }

 }
motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0;
SensorValue[rightEncoder] = 0;


//START LAST LENGTH
while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
	}
}

	motor[leftMotor] = 0;
	motor[rightMotor] = 0;
	wait1Msec(1000);

}
//FINISH TASK//

void goRoom2(){
	wait1Msec(1000);

	SensorValue[rightEncoder] = 0;
	SensorValue[leftEncoder] = 0;

	while(SensorValue[middleLine] < 2500 || SensorValue[leftLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
		//Turn slightly left
	}
 }
 wait1Msec(390);
//FINISH FIRST LENGTH

 motor[leftMotor] = 0; //set motors to 0
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0; //set encoders to 0
SensorValue[rightEncoder] = 0;

//START TURN
while(SensorValue[leftEncoder]> -282 || SensorValue[rightEncoder]< 282)
	{
	motor[rightMotor] = 75;
	motor[leftMotor] = -75;

	if(SensorValue[leftEncoder]< -282)
		{
			motor[leftMotor] = 0;
		}
if(SensorValue[rightEncoder]> 282)
	 {
	motor[rightMotor] = 0;
   }

 }
motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0;
SensorValue[rightEncoder] = 0;

//START SECOND LENGTH
while(SensorValue[middleLine] < 2500 || SensorValue[leftLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
		//Turn slightly left
	}
 }
 wait1Msec(412);
 //FINISH SECOND LENGTH

 motor[rightMotor] = 0;
 motor[leftMotor] = 0;
 wait1Msec(1000);
 SensorValue[rightEncoder] = 0;
 SensorValue[leftEncoder] = 0;

 //START TURN
 while(SensorValue[leftEncoder]> -284 || SensorValue[rightEncoder]< 284)
	{
	motor[rightMotor] = 75;
	motor[leftMotor] = -75;

	if(SensorValue[leftEncoder]< -284)
		{
			motor[leftMotor] = 0;
		}
if(SensorValue[rightEncoder]> 284)
	 {
	motor[rightMotor] = 0;
	 }

 }
 //FINISH TURN

  motor[rightMotor] = 0;
 motor[leftMotor] = 0;
 wait1Msec(1000);
 SensorValue[rightEncoder] = 0;
 SensorValue[leftEncoder] = 0;

 //START THIRD LENGTH

 while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
		//Turn slightly left
	}
 }
 wait1Msec(410);

//FINISH THIRD LENGTH

 motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0;
SensorValue[rightEncoder] = 0;

//START TURN

while(SensorValue[rightEncoder]> -287| SensorValue[leftEncoder]< 287)
	{
	motor[leftMotor] = 75;
	motor[rightMotor] = -75;

	if(SensorValue[rightEncoder]< -287)
		{
			motor[rightMotor] = 0;
		}
if(SensorValue[leftEncoder]> 287)
	 {
	motor[leftMotor] = 0;
   }

 }
 //FINISH TURN

 motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0;
SensorValue[rightEncoder] = 0;

//START FOURTH LENGTH
while(SensorValue[rightEncoder]< 80 || SensorValue[leftEncoder]< 80 )		// Creates an infinite loop, since "true" always evaluates to true
	{
		if(SensorValue[rightEncoder] == SensorValue[leftEncoder]) // If rightEncoder has counted the same amount as leftEncoder:
		{
			// Move Forward
			motor[rightMotor] = 75;
			motor[leftMotor]  = 75;
		}
		else if(SensorValue[rightEncoder] > SensorValue[leftEncoder])	// If rightEncoder has counted more encoder counts
		{
			// Turn slightly right
			motor[rightMotor] = 50;
			motor[leftMotor]  = 75;
		}
		else	// Only runs if leftEncoder has counted more encoder counts
		{
			// Turn slightly left
			motor[rightMotor] = 75;
			motor[leftMotor]  = 50;
		}
	}
	motor[leftMotor] = 0;
	motor[rightMotor] = 0;
	wait1Msec(1000);
	SensorValue[rightEncoder] = 0;
	SensorValue[leftEncoder] = 0;

//RETURN

	//START FIFTH LENGTH

	while(SensorValue[rightEncoder]> -80 || SensorValue[leftEncoder]> -80 )		// Creates an infinite loop, since "true" always evaluates to true
	{
		if(SensorValue[rightEncoder] == SensorValue[leftEncoder]) // If rightEncoder has counted the same amount as leftEncoder:
		{
			// Move Forward
			motor[rightMotor] = -75;
			motor[leftMotor]  = -75;
		}
		else if(SensorValue[rightEncoder] < SensorValue[leftEncoder])	// If rightEncoder has counted more encoder counts
		{
			// Turn slightly right
			motor[rightMotor] = -50;
			motor[leftMotor]  = -75;
		}
		else	// Only runs if leftEncoder has counted more encoder counts
		{
			// Turn slightly left
			motor[rightMotor] = -75;
			motor[leftMotor]  = -50;
		}
	}
	motor[leftMotor] = 0;
	motor[rightMotor] = 0;
	wait1Msec(1000);
	SensorValue[rightEncoder] = 0;
	SensorValue[leftEncoder] = 0;


	//TURN

	while(SensorValue[rightEncoder]> -290| SensorValue[leftEncoder]< 290)
	{
	motor[leftMotor] = 75;
	motor[rightMotor] = -75;

	if(SensorValue[rightEncoder]< -290)
		{
			motor[rightMotor] = 0;
		}
if(SensorValue[leftEncoder]> 290)
	 {
	motor[leftMotor] = 0;
   }

 }
motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0;
SensorValue[rightEncoder] = 0;

//START SIXTH LENGTH

while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
		//Turn slightly left
	}
 }
 wait1Msec(410);
//FINISH SIXTH LENGTH

motor[leftMotor] = 0; //set motors to 0
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0; //set encoders to 0
SensorValue[rightEncoder] = 0;


//START TURN
while(SensorValue[rightEncoder]> -287| SensorValue[leftEncoder]< 287)
	{
	motor[leftMotor] = 75;
	motor[rightMotor] = -75;

	if(SensorValue[rightEncoder]< -287)
		{
			motor[rightMotor] = 0;
		}
if(SensorValue[leftEncoder]> 287)
	 {
	motor[leftMotor] = 0;
   }

 }

motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0;
SensorValue[rightEncoder] = 0;

//START SEVENTH LENGTH
while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
		//Turn slightly left
  }
}
 wait1Msec(410);
//FINISH SEVENTH LENGTH

 motor[rightMotor] = 0;
 motor[leftMotor] = 0;
 wait1Msec(1000);
 SensorValue[leftEncoder] = 0;
 SensorValue[rightEncoder] = 0;

//START TURN
while(SensorValue[rightEncoder]> -290|| SensorValue[leftEncoder]< 290)
	{
	motor[leftMotor] = 75;
	motor[rightMotor] = -75;

	if(SensorValue[rightEncoder]< -290)
		{
			motor[rightMotor] = 0;
		}
if(SensorValue[leftEncoder]> 290)
	 {
	motor[leftMotor] = 0;
   }

 }
//FINISH TURN

 motor[leftMotor] = 0;
 motor[rightMotor] = 0;
 wait1Msec(1000);
 SensorValue[rightEncoder] = 0;
 SensorValue[leftEncoder] = 0;

//START LAST LENGTH

 while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
	}
}

	motor[leftMotor] = 0;
	motor[rightMotor] = 0;
	wait1Msec(1000);

 }
//FINISH TASK//

void goRoom3(){

wait1Msec(1000);

	SensorValue[rightEncoder] = 0;
	SensorValue[leftEncoder] = 0;

	//START FIRST LENGTH

	while(SensorValue[middleLine] < 2500 || SensorValue[leftLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
		//Turn slightly left
	}
 }
 wait1Msec(390);
//FINISH FIRST LENGTH

 motor[leftMotor] = 0; //set motors to 0
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0; //set encoders to 0
SensorValue[rightEncoder] = 0;

//START TURN
while(SensorValue[leftEncoder]> -282 || SensorValue[rightEncoder]< 282)
	{
	motor[rightMotor] = 75;
	motor[leftMotor] = -75;

	if(SensorValue[leftEncoder]< -282)
		{
			motor[leftMotor] = 0;
		}
if(SensorValue[rightEncoder]> 282)
	 {
	motor[rightMotor] = 0;
   }

 }
motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0;
SensorValue[rightEncoder] = 0;

//START SECOND LENGTH
	while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
		//Turn slightly left
	}
 }
 wait1Msec(403);
//FINISH SECOND LENGTH

motor[leftMotor] = 0; //set motors to 0
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0; //set encoders to 0
SensorValue[rightEncoder] = 0;


//START TURN
while(SensorValue[rightEncoder]> -287 || SensorValue[leftEncoder]< 287)
	{
	motor[leftMotor] = 75;
	motor[rightMotor] = -75;

	if(SensorValue[rightEncoder]< -287)
		{
			motor[rightMotor] = 0;
		}
if(SensorValue[leftEncoder]> 287)
	 {
	motor[leftMotor] = 0;
   }

 }
motor[leftMotor] = 0; //set motors to 0
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0; //set encoders to 0
SensorValue[rightEncoder] = 0;

//START THIRD LENGTH

	while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
		//Turn slightly left
	}
 }
 wait1Msec(410);
//FINISH THIRD LENGTH

motor[leftMotor] = 0; //set motors to 0
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0; //set encoders to 0
SensorValue[rightEncoder] = 0;


//START TURN
while(SensorValue[rightEncoder]> -290 || SensorValue[leftEncoder]< 290)
	{
	motor[leftMotor] = 75;
	motor[rightMotor] = -75;

	if(SensorValue[rightEncoder]< -290)
		{
			motor[rightMotor] = 0;
		}
if(SensorValue[leftEncoder]> 290)
	 {
	motor[leftMotor] = 0;
   }

 }

motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0;
SensorValue[rightEncoder] = 0;

//START FOURTH LENGTH
while(SensorValue[rightEncoder]< 80 || SensorValue[leftEncoder]< 80 )		// Creates an infinite loop, since "true" always evaluates to true
	{
		if(SensorValue[rightEncoder] == SensorValue[leftEncoder]) // If rightEncoder has counted the same amount as leftEncoder:
		{
			// Move Forward
			motor[rightMotor] = 75;
			motor[leftMotor]  = 75;
		}
		else if(SensorValue[rightEncoder] > SensorValue[leftEncoder])	// If rightEncoder has counted more encoder counts
		{
			// Turn slightly right
			motor[rightMotor] = 50;
			motor[leftMotor]  = 75;
		}
		else	// Only runs if leftEncoder has counted more encoder counts
		{
			// Turn slightly left
			motor[rightMotor] = 75;
			motor[leftMotor]  = 50;
		}
	}
	motor[leftMotor] = 0;
	motor[rightMotor] = 0;
	wait1Msec(1000);
	SensorValue[rightEncoder] = 0;
	SensorValue[leftEncoder] = 0;


	//RETURN
	//START FIFTH LENGTH
	while(SensorValue[rightEncoder]> -80 || SensorValue[leftEncoder]> -80 )		// Creates an infinite loop, since "true" always evaluates to true
	{
		if(SensorValue[rightEncoder] == SensorValue[leftEncoder]) // If rightEncoder has counted the same amount as leftEncoder:
		{
			// Move Forward
			motor[rightMotor] = -75;
			motor[leftMotor]  = -75;
		}
		else if(SensorValue[rightEncoder] < SensorValue[leftEncoder])	// If rightEncoder has counted more encoder counts
		{
			// Turn slightly right
			motor[rightMotor] = -50;
			motor[leftMotor]  = -75;
		}
		else	// Only runs if leftEncoder has counted more encoder counts
		{
			// Turn slightly left
			motor[rightMotor] = -75;
			motor[leftMotor]  = -50;
		}
	}
	motor[leftMotor] = 0;
	motor[rightMotor] = 0;
	wait1Msec(1000);
	SensorValue[rightEncoder] = 0;
	SensorValue[leftEncoder] = 0;

//START TURN
while(SensorValue[rightEncoder]> -290 || SensorValue[leftEncoder]< 290)
	{
	motor[leftMotor] = 75;
	motor[rightMotor] = -75;

	if(SensorValue[rightEncoder]< -290)
		{
			motor[rightMotor] = 0;
		}
if(SensorValue[leftEncoder]> 290)
	 {
	motor[leftMotor] = 0;
   }

 }

motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0;
SensorValue[rightEncoder] = 0;

//START SIXTH LENGTH

	while(SensorValue[middleLine] < 2500 || SensorValue[leftLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
		//Turn slightly left
	}
 }
 wait1Msec(410);
//FINISH SIXTH LENGTH

 motor[leftMotor] = 0; //set motors to 0
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0; //set encoders to 0
SensorValue[rightEncoder] = 0;

//START TURN
while(SensorValue[leftEncoder]> -290 || SensorValue[rightEncoder]< 290)
	{
	motor[rightMotor] = 75;
	motor[leftMotor] = -75;

	if(SensorValue[leftEncoder]< -290)
		{
			motor[leftMotor] = 0;
		}
if(SensorValue[rightEncoder]> 290)
	 {
	motor[rightMotor] = 0;
   }

 }
motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0;
SensorValue[rightEncoder] = 0;

//START SEVENTH LENGTH

while(SensorValue[middleLine] < 2500 || SensorValue[leftLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
		//Turn slightly left
	}
 }
 wait1Msec(415);

 //TURN

 while(SensorValue[rightEncoder]> -287 || SensorValue[leftEncoder]< 287)
	{
	motor[leftMotor] = 75;
	motor[rightMotor] = -75;

	if(SensorValue[rightEncoder]< -287)
		{
			motor[rightMotor] = 0;
		}
if(SensorValue[leftEncoder]> 287)
	 {
	motor[leftMotor] = 0;
   }

 }

motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0;
SensorValue[rightEncoder] = 0;

//START LAST LENGTH
while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
	}
}

	motor[leftMotor] = 0;
	motor[rightMotor] = 0;
	wait1Msec(1000);


}
//FINISH TASK

void goRoom4(){

	wait1Msec(1000);

	SensorValue[rightEncoder] = 0;
	SensorValue[leftEncoder] = 0;

	while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

		else if(SensorValue[leftLine] > 2500)
		{
			motor[leftMotor] = 50;
			motor[rightMotor] = 75;
			//Turn slightly right
		}

		else if (SensorValue[rightLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 50;
			//Turn slightly left
		}
	}

	motor[leftMotor] = 0; //set motors to 0
	motor[rightMotor] = 0;
	wait1Msec(1000);
	SensorValue[leftEncoder] = 0; //set encoders to 0
	SensorValue[rightEncoder] = 0;

	while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

		else if(SensorValue[leftLine] > 2500)
		{
			motor[leftMotor] = 50;
			motor[rightMotor] = 75;
			//Turn slightly right
		}

		else if (SensorValue[rightLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 50;
			//Turn slightly left
		}
	}
	wait1Msec(413);

	motor[leftMotor] = 0; //set motors to 0
	motor[rightMotor] = 0;
	wait1Msec(1000);
	SensorValue[leftEncoder] = 0; //set encoders to 0
	SensorValue[rightEncoder] = 0;


	//FINISH FIRST LENGTH
	//START TURN
	while(SensorValue[rightEncoder]> -287 || SensorValue[leftEncoder]< 287)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = -75;

		if(SensorValue[rightEncoder]< -287)
		{
			motor[rightMotor] = 0;
		}
		if(SensorValue[leftEncoder]> 287)
		{
			motor[leftMotor] = 0;
		}

	}

	motor[leftMotor] = 0;
	motor[rightMotor] = 0;
	wait1Msec(1000);
	SensorValue[leftEncoder] = 0;
	SensorValue[rightEncoder] = 0;


	//START SECOND LENGTH
	while(SensorValue[middleLine] < 2650 || SensorValue[leftLine] < 2650)
	{
		if(SensorValue[middleLine] > 2650)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

		else if(SensorValue[leftLine] > 2650)
		{
			motor[leftMotor] = 50;
			motor[rightMotor] = 75;
			//Turn slightly right
		}

		else if (SensorValue[rightLine] > 2650)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 50;
			//Turn slightly left
		}
	}
	wait1Msec(410);

	motor[leftMotor] = 0; //set motors to 0
	motor[rightMotor] = 0;
	wait1Msec(1000);
	SensorValue[leftEncoder] = 0; //set encoders to 0
	SensorValue[rightEncoder] = 0;


	//START TURN
	while(SensorValue[leftEncoder]> -287 || SensorValue[rightEncoder]< 287)
	{
	motor[rightMotor] = 75;
	motor[leftMotor] = -75;

	if(SensorValue[leftEncoder]< -287)
		{
			motor[leftMotor] = 0;
		}
if(SensorValue[rightEncoder]> 287)
	 {
	motor[rightMotor] = 0;
	 }

 }
	motor[leftMotor] = 0; //set motors to 0
	motor[rightMotor] = 0;
	wait1Msec(1000);
	SensorValue[leftEncoder] = 0; //set encoders to 0
	SensorValue[rightEncoder] = 0;

	//START THIRD LENGTH
		while(SensorValue[middleLine] < 2500 || SensorValue[leftLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

		else if(SensorValue[leftLine] > 2500)
		{
			motor[leftMotor] = 50;
			motor[rightMotor] = 75;
			//Turn slightly right
		}

		else if (SensorValue[rightLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 50;
			//Turn slightly left
		}
	}
	wait1Msec(410);

	motor[leftMotor] = 0; //set motors to 0
	motor[rightMotor] = 0;
	wait1Msec(1000);
	SensorValue[leftEncoder] = 0; //set encoders to 0
	SensorValue[rightEncoder] = 0;

	//RETURN
	//START TURN
	while(SensorValue[leftEncoder]> -290 || SensorValue[rightEncoder]< 290)
	{
	motor[rightMotor] = 75;
	motor[leftMotor] = -75;

	if(SensorValue[leftEncoder]< -290)
		{
			motor[leftMotor] = 0;
		}
if(SensorValue[rightEncoder]> 290)
	 {
	motor[rightMotor] = 0;
	 }

 }
	motor[leftMotor] = 0; //set motors to 0
	motor[rightMotor] = 0;
	wait1Msec(500);
	SensorValue[leftEncoder] = 0; //set encoders to 0
	SensorValue[rightEncoder] = 0;

	//START FOURTH LENGTH
			while(SensorValue[middleLine] < 2500 || SensorValue[leftLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

		else if(SensorValue[leftLine] > 2500)
		{
			motor[leftMotor] = 50;
			motor[rightMotor] = 75;
			//Turn slightly right
		}

		else if (SensorValue[rightLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 50;
			//Turn slightly left
		}
	}
	wait1Msec(410);

	motor[leftMotor] = 0; //set motors to 0
	motor[rightMotor] = 0;
	wait1Msec(1000);
	SensorValue[leftEncoder] = 0; //set encoders to 0
	SensorValue[rightEncoder] = 0;

	//START TURN
	while(SensorValue[leftEncoder]> -285 || SensorValue[rightEncoder]< 285)
	{
	motor[rightMotor] = 75;
	motor[leftMotor] = -75;

	if(SensorValue[leftEncoder]< -285)
		{
			motor[leftMotor] = 0;
		}
if(SensorValue[rightEncoder]> 285)
	 {
	motor[rightMotor] = 0;
	 }

 }
	motor[leftMotor] = 0; //set motors to 0
	motor[rightMotor] = 0;
	wait1Msec(1000);
	SensorValue[leftEncoder] = 0; //set encoders to 0
	SensorValue[rightEncoder] = 0;

	//START LAST LENGTH
while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
	}
}

motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[rightEncoder] = 0;
SensorValue[leftEncoder] = 0;


while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
	}
}

	motor[leftMotor] = 0;
	motor[rightMotor] = 0;
	wait1Msec(1000);

}
//FINISH TASK

void goRoom5(){
	wait1Msec(1000);

	SensorValue[rightEncoder] = 0;
	SensorValue[leftEncoder] = 0;

	while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
		//Turn slightly left
	}
 }

 motor[leftMotor] = 0; //set motors to 0
motor[rightMotor] = 0;
wait1Msec(500);
SensorValue[leftEncoder] = 0; //set encoders to 0
SensorValue[rightEncoder] = 0;

while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
		//Turn slightly left
	}
 }

 motor[leftMotor] = 0; //set motors to 0
motor[rightMotor] = 0;
wait1Msec(500);
SensorValue[leftEncoder] = 0; //set encoders to 0
SensorValue[rightEncoder] = 0;

while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
		//Turn slightly left
	}
 }
 wait1Msec(410);

 motor[leftMotor] = 0; //set motors to 0
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0; //set encoders to 0
SensorValue[rightEncoder] = 0;

//FINISH FIRST LENGTH
//START TURN

while(SensorValue[rightEncoder]> -295 || SensorValue[leftEncoder]< 295)
	{
	motor[leftMotor] = 75;
	motor[rightMotor] = -75;

	if(SensorValue[rightEncoder]< -295)
		{
			motor[rightMotor] = 0;
		}
if(SensorValue[leftEncoder]> 295)
	 {
	motor[leftMotor] = 0;
   }

 }

motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0;
SensorValue[rightEncoder] = 0;

//START SECOND LENGTH
 while(SensorValue[rightEncoder]< 300 || SensorValue[leftEncoder]< 300 )		// Creates an infinite loop, since "true" always evaluates to true
	{
		if(SensorValue[rightEncoder] == SensorValue[leftEncoder]) // If rightEncoder has counted the same amount as leftEncoder:
		{
			// Move Forward
			motor[rightMotor] = 75;
			motor[leftMotor]  = 75;
		}
		else if(SensorValue[rightEncoder] > SensorValue[leftEncoder])	// If rightEncoder has counted more encoder counts
		{
			// Turn slightly right
			motor[rightMotor] = 50;
			motor[leftMotor]  = 75;
		}
		else	// Only runs if leftEncoder has counted more encoder counts
		{
			// Turn slightly left
			motor[rightMotor] = 75;
			motor[leftMotor]  = 50;
		}
	}
	motor[leftMotor] = 0;
	motor[rightMotor] = 0;
	wait1Msec(1000);
  SensorValue[rightEncoder] = 0;
	SensorValue[leftEncoder] = 0;

	//RETURN
//START THIRD LENGTH
while(SensorValue[rightEncoder]> -300 || SensorValue[leftEncoder]> -300 )		// Creates an infinite loop, since "true" always evaluates to true
	{
		if(SensorValue[rightEncoder] == SensorValue[leftEncoder]) // If rightEncoder has counted the same amount as leftEncoder:
		{
			// Move Forward
			motor[rightMotor] = -75;
			motor[leftMotor]  = -75;
		}
		else if(SensorValue[rightEncoder] < SensorValue[leftEncoder])	// If rightEncoder has counted more encoder counts
		{
			// Turn slightly right
			motor[rightMotor] = -50;
			motor[leftMotor]  = -75;
		}
		else	// Only runs if leftEncoder has counted more encoder counts
		{
			// Turn slightly left
			motor[rightMotor] = -75;
			motor[leftMotor]  = -50;
		}
	}
	motor[leftMotor] = 0;
	motor[rightMotor] = 0;
	wait1Msec(1000);
	SensorValue[rightEncoder] = 0;
	SensorValue[leftEncoder] = 0;

	//TURN
	while(SensorValue[rightEncoder]> -290 || SensorValue[leftEncoder]< 290)
	{
	motor[leftMotor] = 75;
	motor[rightMotor] = -75;

	if(SensorValue[rightEncoder]< -290)
		{
			motor[rightMotor] = 0;
		}
if(SensorValue[leftEncoder]> 290)
	 {
	motor[leftMotor] = 0;
   }

 }

motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(1000);
SensorValue[leftEncoder] = 0;
SensorValue[rightEncoder] = 0;

//START LAST LENGTH
while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
	}
}

motor[leftMotor] = 0;
motor[rightMotor] = 0;
wait1Msec(500);
SensorValue[rightEncoder] = 0;
SensorValue[leftEncoder] = 0;


while(SensorValue[middleLine] < 2500 || SensorValue[rightLine] < 2500)
	{
		if(SensorValue[middleLine] > 2500)
		{
			motor[leftMotor] = 75;
			motor[rightMotor] = 75;
			//Move forward
		}

	else if(SensorValue[leftLine] > 2500)
	{
		motor[leftMotor] = 50;
		motor[rightMotor] = 75;
		//Turn slightly right
	}

	else if (SensorValue[rightLine] > 2500)
	{
		motor[leftMotor] = 75;
		motor[rightMotor] = 50;
	}
}

	motor[leftMotor] = 0;
	motor[rightMotor] = 0;
	wait1Msec(1000);


	}
	//FINISH TASK
